import requset from '../../../src/utils/requset';
import { loginForim,loginres,userres,registerForim,acltype} from "./type";
enum API{
    loginurl = '/user/login',
    userinfourl = '/user/info',
    registerurl = '/user/register',
    swiperurl='carousel/list',//轮播图
    achurl='ach/list',//成果列表
    achdetail = 'ach/detail',//成果详情
    demurl = '/dem/list',//需求列表
    demdetail = 'dem/detail',//需求详情
    teacherurl = 'user/list/teacher',//教师列表
    teacherdetailurl = 'user/detail',//教师详情
    noticeurl = 'notice/list',//公告列表
    adviceurl = 'advice/list',//政策列表
    userachurl = 'ach/listByUser',//用户成果列表
    userdemurl = 'dem/listByUser',//用户需求列表
    statisticsurl = 'home/statistics',//统计列表
    noticeDetailurl = 'notice/detail',//公告详情
    adviceDetailurl = 'advice/detail',//政策详情
    newsurl = 'news/list',//新闻列表
    newsdetailurl = 'news/detail',//新闻详情
   
}

export const reqlogin = (data:loginForim) =>requset.post<any,loginres>(API.loginurl,data)
export const requserinfo =()=>requset.get<any,userres>(API.userinfourl)
export const userregister = (data:registerForim)=>requset.post<any>( API.registerurl,data)
export const getswiper =()=>requset.get(API.swiperurl)
export const getach =(data:acltype)=>requset.get(API.achurl)
export const getdem =()=>requset.get(API.demurl)
export const getteacher =(current,limit)=>requset.get(API.teacherurl+"?current="+current + "&limit=" +limit)
export const getteacherdetail =(data)=>requset.get(API.teacherdetailurl+'?id='+data)
export const getnotice =(current,limit)=>requset.get(API.noticeurl+"?current="+current + "&limit=" +limit)
export const getadvice =(current,limit)=>requset.get(API.adviceurl+"?current="+current + "&limit=" +limit)
export const getuserach =(data)=>requset.get(API.userachurl+"?userId="+data)
export const getuserdem =(data)=>requset.get(API.userdemurl+"?userId="+data)
export const getstatistics =()=>requset.get(API.statisticsurl)
export const getnoticedetail =(data)=>requset.get(API.noticeDetailurl+'?id='+data)
export const getadvicedetail =(data)=>requset.get(API.adviceDetailurl+'?id='+data)
export const getnews =(current,limit)=>requset.get(API.newsurl+"?current="+current + "&limit=" +limit)
export const getnewsdetail =(data)=>requset.get(API.newsdetailurl+'?id='+data)
export const getachdetail =(data)=>requset.get(API.achdetail+'?id='+data)
export const getdemdetail =(data)=>requset.get(API.demdetail+'?id='+data)

